import { useUserStore } from "@/store/useUserStore";
import { useMenuStore } from "@/store/useMenuStore";
import { ElMessage } from "element-plus";
// import { useRouter } from "vue-router";
import router from "@router";
export const useLoginAction = async (data: string) => {
  // const router = useRouter();  // 在函数内部调用 useRouter
  localStorage.setItem("TOKEN", data);
  await useUserStore().getUserInfo();
  await useMenuStore().getMenu();
  await ElMessage.success("登录成功");
  router.push("/");
};
